home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5949 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  60 lines

  1. Path: hermes.oc.com!usenet
  2. From: adrianb@ug.eds.com (Adrian Brown)
  3. Newsgroups: comp.lang.c++
  4. Subject: Placement-new with virtual function problem on HP
  5. Date: 7 Feb 1996 16:11:02 GMT
  6. Organization: EDS Unigraphics, Cambridge, England
  7. Message-ID: <4faium$2c6@hermes.oc.com>
  8. NNTP-Posting-Host: boisdarc.etsu.edu
  9. X-Newsreader: knews 0.9.3
  10.  
  11. Is the following valid C++:
  12.  
  13. -------------------------------------------------------------
  14. #include <stddef.h>
  15.  
  16. class test
  17. {
  18.   public:
  19.  
  20.     virtual void between_the_ears();
  21.  
  22.   private:
  23.  
  24.     static void *operator new(size_t size, int pool_id);
  25.     static void operator delete(void *memory, size_t size);
  26. };
  27. -------------------------------------------------------------
  28.  
  29. On Solaris and SGI it compiles without errors or warnings.
  30.  
  31. However, using the HP C++ compiler I get the following error:
  32.  
  33. CC: "test1.cpp", line 4: error: argument  2 of type int  expected for 
  34. test::operator new() (1266)
  35.  
  36. There was no additional documentation (that I could find) on error 1266.
  37. In case it makes any different it is an HP 9000/710 running HP-UX 9.05
  38. and the compile command is as follows:
  39.  
  40. /usr/bin/CC -Aa +Z +p +w -c test1.cpp
  41.  
  42. Oddly enough, if I comment out the virtual function, it compiles
  43. without error.  Similarly if I use the non-placement form of the 
  44. new operator:
  45.    static void *operator new(size_t size);
  46. it also compiles without error.
  47.  
  48. Is this me, or is it the compiler?
  49.  
  50. Thanks
  51. AdrianB
  52. -- 
  53.  
  54. ==================================================================
  55. Adrian Brown (Assemblies Development, Shape Data, EDS Unigraphics)
  56.  
  57. Email: adrianb@ug.eds.com
  58. Phone: +44 (1223) 371601
  59.  
  60.